﻿namespace Wuqi.Webdiyer
{
    using System;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.IO;
    using System.Security.Permissions;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    [DefaultEvent("PageChanged"), PersistChildren(false), ANPDescription("desc_AspNetPager"), ToolboxData("<{0}:AspNetPager runat=server></{0}:AspNetPager>"), Designer(typeof(PagerDesigner)), DefaultProperty("PageSize"), ParseChildren(false), AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public class AspNetPager : Panel, INamingContainer, IPostBackEventHandler, IPostBackDataHandler
    {
        private AspNetPager cloneFrom;
        private string cssClassName;
        private string currentUrl;
        private static readonly object EventPageChanged = new object();
        private static readonly object EventPageChanging = new object();
        private static readonly object EventPageSizeChanging = new object();
        private string inputPageIndex;
        private string queryString;
        private const string ver = "7.0.2";

        public event EventHandler PageChanged
        {
            add
            {
                base.Events.AddHandler(EventPageChanged, value);
            }
            remove
            {
                base.Events.RemoveHandler(EventPageChanged, value);
            }
        }

        public event PageChangingEventHandler PageChanging
        {
            add
            {
                base.Events.AddHandler(EventPageChanging, value);
            }
            remove
            {
                base.Events.RemoveHandler(EventPageChanging, value);
            }
        }

        /// <summary>
        /// PageSize发生变化的事件
        /// </summary>
        public event EventHandler PageSizeChanging
        {
            add
            {
                base.Events.AddHandler(EventPageSizeChanging,value);
            }
            remove
            {
                base.Events.RemoveHandler(EventPageSizeChanging,value);
            }
        }

        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if ((this.Page != null) && !this.UrlPaging)
            {
                this.Page.VerifyRenderingInServerForm(this);
            }
            base.AddAttributesToRender(writer);
        }

        private void AddHyperlinkTarget(HtmlTextWriter writer)
        {
            if (!string.IsNullOrEmpty(this.UrlPagingTarget))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Target, this.UrlPagingTarget);
            }
        }

        private void addMoreListItem(HtmlTextWriter writer, int pageIndex)
        {
            writer.Write("<option value=\"");
            writer.Write(pageIndex);
            writer.Write("\">......</option>");
        }

        private void AddToolTip(HtmlTextWriter writer, int pageIndex)
        {
            if (this.ShowNavigationToolTip)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, string.Format(this.NavigationToolTipTextFormatString, pageIndex));
            }
        }

        private string BuildUrlString(string sk, string sv)
        {
            StringBuilder builder = new StringBuilder(80);
            bool flag = false;
            int num = (this.queryString != null) ? this.queryString.Length : 0;
            for (int i = 0; i < num; i++)
            {
                string str2;
                int startIndex = i;
                int num4 = -1;
                while (i < num)
                {
                    char ch = this.queryString[i];
                    if (ch == '=')
                    {
                        if (num4 < 0)
                        {
                            num4 = i;
                        }
                    }
                    else if (ch == '&')
                    {
                        break;
                    }
                    i++;
                }
                string str = null;
                if (num4 >= 0)
                {
                    str = this.queryString.Substring(startIndex, num4 - startIndex);
                    str2 = this.queryString.Substring(num4 + 1, (i - num4) - 1);
                }
                else
                {
                    str2 = this.queryString.Substring(startIndex, i - startIndex);
                }
                builder.Append(str).Append("=");
                if (str == sk)
                {
                    flag = true;
                    builder.Append(sv);
                }
                else
                {
                    builder.Append(str2);
                }
                builder.Append("&");
            }
            if (!flag)
            {
                builder.Append(sk).Append("=").Append(sv);
            }
            builder.Insert(0, "?").Insert(0, Path.GetFileName(this.currentUrl));
            return builder.ToString().Trim(new char[] { '&' });
        }

        private static NameValueCollection ConvertQueryStringToCollection(string s)
        {
            NameValueCollection values = new NameValueCollection();
            int num = (s != null) ? s.Length : 0;
            for (int i = 0; i < num; i++)
            {
                string str2;
                int startIndex = i;
                int num4 = -1;
                while (i < num)
                {
                    char ch = s[i];
                    if (ch == '=')
                    {
                        if (num4 < 0)
                        {
                            num4 = i;
                        }
                    }
                    else if (ch == '&')
                    {
                        break;
                    }
                    i++;
                }
                string name = null;
                if (num4 >= 0)
                {
                    name = s.Substring(startIndex, num4 - startIndex);
                    str2 = s.Substring(num4 + 1, (i - num4) - 1);
                }
                else
                {
                    str2 = s.Substring(startIndex, i - startIndex);
                }
                values.Add(name, str2);
                if ((i == (num - 1)) && (s[i] == '&'))
                {
                    values.Add(null, string.Empty);
                }
            }
            return values;
        }

        private void CreateMoreButton(HtmlTextWriter writer, int pageIndex)
        {
            //this.writeSpacingStyle(writer);
            //writer.RenderBeginTag(HtmlTextWriterTag.Span);
            //this.WriteCssClass(writer);
            //writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(pageIndex));
            //this.AddToolTip(writer, pageIndex);
            //this.AddHyperlinkTarget(writer);
            //writer.RenderBeginTag(HtmlTextWriterTag.A);
            //if ((this.PagingButtonType == Wuqi.Webdiyer.PagingButtonType.Image) && (this.MoreButtonType == Wuqi.Webdiyer.PagingButtonType.Image))
            //{
            //    writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + "more" + this.ButtonImageNameExtension + this.ButtonImageExtension);
            //    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            //    if (this.ButtonImageAlign != ImageAlign.NotSet)
            //    {
            //        writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
            //    }
            //    writer.RenderBeginTag(HtmlTextWriterTag.Img);
            //    writer.RenderEndTag();
            //}
            //else
            //{
            //    writer.Write("...");
            //}
            //writer.RenderEndTag();
            //writer.RenderEndTag();
        }

        private void CreateNavigationButton(HtmlTextWriter writer, string btnname)
        {
            if ((this.ShowFirstLast || ((btnname != "first") && (btnname != "last"))) && (this.ShowPrevNext || ((btnname != "prev") && (btnname != "next"))))
            {
                string str;
                bool flag;
                int num;
                bool flag2 = (this.PagingButtonType == Wuqi.Webdiyer.PagingButtonType.Image) && (this.NavigationButtonType == Wuqi.Webdiyer.PagingButtonType.Image);
                if ((btnname == "prev") || (btnname == "first"))
                {
                    flag = (this.CurrentPageIndex <= 1) | !this.Enabled;
                    if (this.ShowDisabledButtons || !flag)
                    {
                        num = (btnname == "first") ? 1 : (this.CurrentPageIndex - 1);
                        this.writeSpacingStyle(writer);
                        if (flag2)
                        {
                            if (!flag)
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(num));
                                this.AddToolTip(writer, num);
                                this.AddHyperlinkTarget(writer);
                                writer.RenderBeginTag(HtmlTextWriterTag.A);
                                writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + btnname + this.ButtonImageNameExtension + this.ButtonImageExtension);
                                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                                if (this.ButtonImageAlign != ImageAlign.NotSet)
                                {
                                    writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
                                }
                                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                                writer.RenderEndTag();
                                writer.RenderEndTag();
                            }
                            else
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + btnname + this.DisabledButtonImageNameExtension + this.ButtonImageExtension);
                                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                                if (this.ButtonImageAlign != ImageAlign.NotSet)
                                {
                                    writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
                                }
                                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                                writer.RenderEndTag();
                            }
                        }
                        else
                        {
                            str = (btnname == "prev") ? this.PrevPageText : this.FirstPageText;
                            if (flag)
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
                            }
                            else
                            {
                                this.WriteCssClass(writer);
                                this.AddToolTip(writer, num);
                                this.AddHyperlinkTarget(writer);
                                writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(num));
                            }
                            writer.RenderBeginTag(HtmlTextWriterTag.A);
                            writer.Write(str);
                            writer.RenderEndTag();
                        }
                    }
                }
                else
                {
                    flag = (this.CurrentPageIndex >= this.PageCount) | !this.Enabled;
                    if (this.ShowDisabledButtons || !flag)
                    {
                        num = (btnname == "last") ? this.PageCount : (this.CurrentPageIndex + 1);
                        this.writeSpacingStyle(writer);
                        if (flag2)
                        {
                            if (!flag)
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(num));
                                this.AddToolTip(writer, num);
                                this.AddHyperlinkTarget(writer);
                                writer.RenderBeginTag(HtmlTextWriterTag.A);
                                writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + btnname + this.ButtonImageNameExtension + this.ButtonImageExtension);
                                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                                if (this.ButtonImageAlign != ImageAlign.NotSet)
                                {
                                    writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
                                }
                                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                                writer.RenderEndTag();
                                writer.RenderEndTag();
                            }
                            else
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + btnname + this.DisabledButtonImageNameExtension + this.ButtonImageExtension);
                                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                                if (this.ButtonImageAlign != ImageAlign.NotSet)
                                {
                                    writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
                                }
                                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                                writer.RenderEndTag();
                            }
                        }
                        else
                        {
                            str = (btnname == "next") ? this.NextPageText : this.LastPageText;
                            if (flag)
                            {
                                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
                            }
                            else
                            {
                                this.WriteCssClass(writer);
                                this.AddToolTip(writer, num);
                                writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(num));
                                this.AddHyperlinkTarget(writer);
                            }
                            writer.RenderBeginTag(HtmlTextWriterTag.A);
                            writer.Write(str);
                            writer.RenderEndTag();
                        }
                    }
                }
            }
        }

        private void CreateNumericButton(HtmlTextWriter writer, int index)
        {
            bool isCurrent = index == this.CurrentPageIndex;
            if ((this.PagingButtonType == Wuqi.Webdiyer.PagingButtonType.Image) && (this.NumericButtonType == Wuqi.Webdiyer.PagingButtonType.Image))
            {
                this.writeSpacingStyle(writer);
                if (!isCurrent)
                {
                    if (this.Enabled)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(index));
                    }
                    this.AddToolTip(writer, index);
                    this.AddHyperlinkTarget(writer);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    this.CreateNumericImages(writer, index, isCurrent);
                    writer.RenderEndTag();
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.CurrentPageButtonClass))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CurrentPageButtonClass);
                    }
                    if (!string.IsNullOrEmpty(this.CurrentPageButtonStyle))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Style, this.CurrentPageButtonStyle);
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    this.CreateNumericImages(writer, index, isCurrent);
                    writer.RenderEndTag();
                }
            }
            else
            {
                this.writeSpacingStyle(writer);
                if (isCurrent)
                {
                    if (string.IsNullOrEmpty(this.CurrentPageButtonClass) && string.IsNullOrEmpty(this.CurrentPageButtonStyle))
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "red");
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(this.CurrentPageButtonClass))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CurrentPageButtonClass);
                        }
                        if (!string.IsNullOrEmpty(this.CurrentPageButtonStyle))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Style, this.CurrentPageButtonStyle);
                        }
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    if (!string.IsNullOrEmpty(this.CurrentPageButtonTextFormatString))
                    {
                        writer.Write(string.Format(this.CurrentPageButtonTextFormatString, index));
                    }
                    else
                    {
                        writer.Write(index);
                    }
                    writer.RenderEndTag();
                }
                else
                {
                    if (this.Enabled)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(index));
                    }
                    this.WriteCssClass(writer);
                    this.AddToolTip(writer, index);
                    this.AddHyperlinkTarget(writer);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    if (!string.IsNullOrEmpty(this.NumericButtonTextFormatString))
                    {
                        writer.Write(string.Format(this.NumericButtonTextFormatString, index));
                    }
                    else
                    {
                        writer.Write(index);
                    }
                    writer.RenderEndTag();
                }
            }
        }

        private void CreateNumericImages(HtmlTextWriter writer, int index, bool isCurrent)
        {
            string str = index.ToString();
            for (int i = 0; i < str.Length; i++)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, string.Concat(new object[] { this.ImagePath, str[i], isCurrent ? this.CpiButtonImageNameExtension : this.ButtonImageNameExtension, this.ButtonImageExtension }));
                if (this.ButtonImageAlign != ImageAlign.NotSet)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
        }


        /// <summary>
        /// 默认增加3个选项10,30,50
        /// </summary>
        /// <param name="writer"></param>
        private void CreatePageSizeSelect(HtmlTextWriter writer)
        {
            var count = 3;
            var desp = 20;
            int g = 10;
            DropDownList select = new DropDownList();
            for (int i = 0; i < count; i++)
            {
                ListItem item = new ListItem(g.ToString(), g.ToString());
                g = g + desp;
                select.Items.Add(item);
            }
            select.ID = this.UniqueID + "_desp_select";
            select.SelectedValue = this.PageSize.ToString();
            select.EnableViewState = true;
            select.AutoPostBack = true;
            select.Attributes["onchange"] = "javascript:__doPostBack('" + select.ID + "','')";
            select.RenderControl(writer);
        }

        protected void select_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (sender is DropDownList)
            {
                DropDownList ddl = ((DropDownList)sender);
                this.PageSize = int.Parse(ddl.SelectedValue);
                this.OnLoad(e);
            }
        }

        private string GetCustomInfoHTML(string origText)
        {
            if (string.IsNullOrEmpty(origText) || (origText.IndexOf('%') < 0))
            {
                return origText;
            }
            string[] array = new string[] { "recordcount", "pagecount", "currentpageindex", "startrecordindex", "endrecordindex", "pagesize", "pagesremain", "recordsremain" };
            StringBuilder builder = new StringBuilder(origText);
            Regex regex = new Regex(@"(?<ph>%(?<pname>\w{8,})%)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            foreach (Match match in regex.Matches(origText))
            {
                string str = match.Groups["pname"].Value.ToLower();
                if (Array.IndexOf<string>(array, str) >= 0)
                {
                    string newValue = null;
                    switch (str)
                    {
                        case "recordcount":
                            newValue = this.RecordCount.ToString();
                            break;

                        case "pagecount":
                            newValue = this.PageCount.ToString();
                            break;

                        case "currentpageindex":
                            newValue = this.CurrentPageIndex.ToString();
                            break;

                        case "startrecordindex":
                            newValue = this.StartRecordIndex.ToString();
                            break;

                        case "endrecordindex":
                            newValue = this.EndRecordIndex.ToString();
                            break;

                        case "pagesize":
                            newValue = this.PageSize.ToString();
                            break;

                        case "pagesremain":
                            newValue = this.PagesRemain.ToString();
                            break;

                        case "recordsremain":
                            newValue = this.RecordsRemain.ToString();
                            break;
                    }
                    if (newValue != null)
                    {
                        builder.Replace(match.Groups["ph"].Value, newValue);
                    }
                }
            }
            return builder.ToString();
        }

        private string GetHrefString(int pageIndex)
        {
            if (!this.UrlPaging)
            {
                return this.Page.ClientScript.GetPostBackClientHyperlink(this, pageIndex.ToString());
            }
            int num = pageIndex;
            string str = "pi";
            if (this.ReverseUrlPageIndex)
            {
                str = "(" + this.PageCount + "-pi+1)";
                num = (pageIndex == -1) ? -1 : ((this.PageCount - pageIndex) + 1);
            }
            if (!this.EnableUrlRewriting)
            {
                return this.BuildUrlString(this.UrlPageIndexName, (num == -1) ? ("\"+" + str + "+\"") : num.ToString());
            }
            MatchCollection matchs = new Regex("(?<p>%(?<m>[^%]+)%)", RegexOptions.Compiled | RegexOptions.IgnoreCase).Matches(this.UrlRewritePattern);
            NameValueCollection values = ConvertQueryStringToCollection(this.queryString);
            string urlRewritePattern = this.UrlRewritePattern;
            foreach (Match match in matchs)
            {
                string newValue = values[match.Groups["m"].Value];
                urlRewritePattern = urlRewritePattern.Replace(match.Groups["p"].Value, newValue);
            }
            return base.ResolveUrl(string.Format(urlRewritePattern, (num == -1) ? ("\"+" + str + "+\"") : num.ToString()));
        }

        private void listPageIndexes(HtmlTextWriter writer, int startIndex, int endIndex)
        {
            for (int i = startIndex; i <= endIndex; i++)
            {
                writer.Write("<option value=\"");
                writer.Write(i);
                writer.Write("\"");
                if (i == this.CurrentPageIndex)
                {
                    writer.Write(" selected=\"true\"");
                }
                writer.Write(">");
                writer.Write(i);
                writer.Write("</option>");
            }
        }

        public virtual bool LoadPostData(string pkey, NameValueCollection pcol)
        {
            string s = pcol[this.UniqueID + "_input"];
            if ((s != null) && (s.Trim().Length > 0))
            {
                try
                {
                    int num = int.Parse(s);
                    if ((num > 0) && (num <= this.PageCount))
                    {
                        this.inputPageIndex = s;
                        this.Page.RegisterRequiresRaiseEvent(this);
                    }
                }
                catch
                {
                }
            }
            return false;
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if ((this.CloneFrom != null) && (string.Empty != this.CloneFrom.Trim()))
            {
                AspNetPager pager = this.Parent.FindControl(this.CloneFrom) as AspNetPager;
                if (pager == null)
                {
                    string str = Wuqi.Webdiyer.SR.GetString("clonefromexeption");
                    if (str == null)
                    {
                        str = "The control \" %controlID% \" does not exist or is not of type Wuqi.Webdiyer.AspNetPager!";
                    }
                    throw new ArgumentException(str.Replace("%controlID%", this.CloneFrom), "CloneFrom");
                }
                if ((pager.cloneFrom != null) && (this == pager.cloneFrom))
                {
                    string message = Wuqi.Webdiyer.SR.GetString("recusiveclonefrom");
                    if (message == null)
                    {
                        message = "Invalid value for the CloneFrom property, AspNetPager controls can not to be cloned recursively!";
                    }
                    throw new ArgumentException(message, "CloneFrom");
                }
                this.cloneFrom = pager;
                this.CssClass = this.cloneFrom.CssClass;
                this.Width = this.cloneFrom.Width;
                this.Height = this.cloneFrom.Height;
                this.HorizontalAlign = this.cloneFrom.HorizontalAlign;
                this.BackColor = this.cloneFrom.BackColor;
                this.BackImageUrl = this.cloneFrom.BackImageUrl;
                this.BorderColor = this.cloneFrom.BorderColor;
                this.BorderStyle = this.cloneFrom.BorderStyle;
                this.BorderWidth = this.cloneFrom.BorderWidth;
                this.Font.CopyFrom(this.cloneFrom.Font);
                this.ForeColor = this.cloneFrom.ForeColor;
                this.EnableViewState = this.cloneFrom.EnableViewState;
                this.Enabled = this.cloneFrom.Enabled;
            }
           
        }

        protected override void OnLoad(EventArgs e)
        {
            if (this.UrlPaging)
            {
                this.currentUrl = this.Page.Request.Path;
                this.queryString = this.Page.Request.ServerVariables["Query_String"];
                if (!this.Page.IsPostBack && (this.cloneFrom == null))
                {
                    int num;
                    int.TryParse(this.Page.Request.QueryString[this.UrlPageIndexName], out num);
                    if (num <= 0)
                    {
                        num = 1;
                    }
                    else if (this.ReverseUrlPageIndex)
                    {
                        num = (this.PageCount - num) + 1;
                    }
                    PageChangingEventArgs args = new PageChangingEventArgs(num);
                    this.OnPageChanging(args);
                }
            }
            else
            {
                //Request["__EVENTTARGET"];          //：获取得到引发页面PostBack的控件ID  
                //Request["__EVENTARGUMENT"];    //： 获取参数。
                //string postBackId = this.Page.Request["__EVENTTARGET"];
                this.inputPageIndex = this.Page.Request.Form[this.UniqueID + "_input"];
                string postBackId = this.Page.Request.Params["__EVENTTARGET"];
                if (!string.IsNullOrEmpty(postBackId) && postBackId.Contains("_desp_select"))
                {
                    if (!string.IsNullOrEmpty(this.Page.Request.Params[postBackId]))
                    {
                        ViewState["epagesize"] = this.Page.Request.Params[postBackId];
                    }
                    if (ViewState["epagesize"] != null)
                    {
                        this.PageSize = int.Parse(ViewState["epagesize"].ToString());
                    }
                    EventArgs args = new EventArgs();
                    this.OnPageSizeChanging(args);
                }
                //回发时执行
                //added by jiejiep
                //if (!string.IsNullOrEmpty(this.inputPageIndex))
                //{
                //    PageChangingEventArgs args = new PageChangingEventArgs(int.Parse(inputPageIndex));
                //    this.OnPageChanging(args);
                //}
            }
            base.OnLoad(e);
        }

        protected virtual void OnPageChanged(EventArgs e)
        {
            EventHandler handler = (EventHandler)base.Events[EventPageChanged];
            if (handler != null)
            {
                handler(this, e);
            }
        }

        protected virtual void OnPageChanging(PageChangingEventArgs e)
        {
            PageChangingEventHandler handler = (PageChangingEventHandler)base.Events[EventPageChanging];
            if (handler != null)
            {
                handler(this, e);
                if (!e.Cancel || this.UrlPaging)
                {
                    this.CurrentPageIndex = e.NewPageIndex;
                    this.OnPageChanged(EventArgs.Empty);
                }
            }
            else
            {
                this.CurrentPageIndex = e.NewPageIndex;
                this.OnPageChanged(EventArgs.Empty);
            }
        }

        /// <summary>
        /// 页面条数改变事件
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnPageSizeChanging(EventArgs e)
        {
            EventHandler handler = (EventHandler)base.Events[EventPageSizeChanging];
            if (handler != null)
            {
                handler(this, e);
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            if ((this.PageCount > 1) && ((this.ShowPageIndexBox == Wuqi.Webdiyer.ShowPageIndexBox.Always) || ((this.ShowPageIndexBox == Wuqi.Webdiyer.ShowPageIndexBox.Auto) && (this.PageCount >= this.ShowBoxThreshold))))
            {
                StringBuilder builder = new StringBuilder("<script language=\"Javascript\"><!--\n");
                if (this.UrlPaging)
                {
                    builder.Append("function ANP_goToPage(boxEl){if(boxEl!=null){var pi;if(boxEl.tagName==\"SELECT\")");
                    builder.Append("{pi=boxEl.options[boxEl.selectedIndex].value;}else{pi=boxEl.value;}");
                    if (string.IsNullOrEmpty(this.UrlPagingTarget))
                    {
                        builder.Append("location.href=\"").Append(this.GetHrefString(-1)).Append("\"");
                    }
                    else
                    {
                        builder.Append("window.open(\"").Append(this.GetHrefString(-1)).Append("\",\"").Append(this.UrlPagingTarget).Append("\")");
                    }
                    builder.Append(";}}\n");
                }
                if (this.PageIndexBoxType == Wuqi.Webdiyer.PageIndexBoxType.TextBox)
                {
                    string str = Wuqi.Webdiyer.SR.GetString("checkinputscript");
                    if (str != null)
                    {
                        str = str.Replace("%PageIndexOutOfRangeErrorMessage%", this.PageIndexOutOfRangeErrorMessage).Replace("%InvalidPageIndexErrorMessage%", this.InvalidPageIndexErrorMessage);
                    }
                    builder.Append(str).Append("\n");
                    string str2 = Wuqi.Webdiyer.SR.GetString("keydownscript");
                    builder.Append(str2);
                }
                builder.Append("\n--></script>");
                Type type = base.GetType();
                ClientScriptManager clientScript = this.Page.ClientScript;
                if (!clientScript.IsClientScriptBlockRegistered(type, "anp_script"))
                {
                    clientScript.RegisterClientScriptBlock(type, "anp_script", builder.ToString());
                }
            }
            base.OnPreRender(e);
        }

        public void RaisePostBackEvent(string args)
        {
            int currentPageIndex = this.CurrentPageIndex;
            try
            {
                if ((args == null) || (args == ""))
                {
                    args = this.inputPageIndex;
                }
                currentPageIndex = int.Parse(args);
            }
            catch
            {
            }
            PageChangingEventArgs e = new PageChangingEventArgs(currentPageIndex);
            if (this.cloneFrom != null)
            {
                this.cloneFrom.OnPageChanging(e);
            }
            else
            {
                this.OnPageChanging(e);
            }
        }

        public virtual void RaisePostDataChangedEvent()
        {
        }

        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            bool flag = (this.PageCount > 1) || ((this.PageCount <= 1) && this.AlwaysShow);
            writer.WriteLine();
            if (flag)
            {
                base.RenderBeginTag(writer);
            }
        }

        protected override void RenderContents(HtmlTextWriter writer)
        {
            if ((this.PageCount > 1) || this.AlwaysShow)
            {
                writer.Indent = 0;
                if (this.ShowCustomInfoSection == Wuqi.Webdiyer.ShowCustomInfoSection.Left)
                {
                    this.RenderCustomInfoSection(writer);
                }
                if (this.ShowCustomInfoSection != Wuqi.Webdiyer.ShowCustomInfoSection.Never)
                {
                    if (this.CustomInfoSectionWidth.Type == UnitType.Percentage)
                    {
                        //writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Unit.Percentage(100.0 - this.CustomInfoSectionWidth.Value).ToString());
                    }
                    if (this.HorizontalAlign != HorizontalAlign.NotSet)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Align, this.HorizontalAlign.ToString().ToLower());
                    }
                    if (!string.IsNullOrEmpty(this.CssClass))
                    {
                        //writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
                    }
                    //writer.AddStyleAttribute("float", "left");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                }
                int pageIndex = ((this.CurrentPageIndex - 1) / this.NumericButtonCount) * this.NumericButtonCount;
                if (this.PageCount > this.NumericButtonCount)
                {
                    int num2 = this.CurrentPageIndex - ((int)Math.Ceiling((double)(((double)this.NumericButtonCount) / 2.0)));
                    if (this.CenterCurrentPageButton && (num2 > 0))
                    {
                        pageIndex = num2;
                        if (pageIndex > (this.PageCount - this.NumericButtonCount))
                        {
                            pageIndex = this.PageCount - this.NumericButtonCount;
                        }
                    }
                }
                int num3 = ((pageIndex + this.NumericButtonCount) > this.PageCount) ? this.PageCount : (pageIndex + this.NumericButtonCount);
                //this.CreateNavigationButton(writer, "first");
                this.CreateNavigationButton(writer, "prev");
                if (this.ShowPageIndex)
                {
                    if (pageIndex > 0)
                    {
                        this.CreateMoreButton(writer, pageIndex);
                    }
                    for (int i = pageIndex + 1; i <= num3; i++)
                    {
                        this.CreateNumericButton(writer, i);
                    }
                    if ((this.PageCount > this.NumericButtonCount) && (num3 < this.PageCount))
                    {
                        this.CreateMoreButton(writer, num3 + 1);
                    }
                }
                this.CreateNavigationButton(writer, "next");
                //this.CreateNavigationButton(writer, "last");
                if ((this.ShowPageIndexBox == Wuqi.Webdiyer.ShowPageIndexBox.Always) || ((this.ShowPageIndexBox == Wuqi.Webdiyer.ShowPageIndexBox.Auto) && (this.PageCount >= this.ShowBoxThreshold)))
                {
                    string str = this.UniqueID + "_input";
                    writer.Write("&nbsp;&nbsp;");
                    if (!string.IsNullOrEmpty(this.TextBeforePageIndexBox))
                    {
                        writer.Write(this.TextBeforePageIndexBox);
                    }
                    if (this.PageIndexBoxType == Wuqi.Webdiyer.PageIndexBoxType.TextBox)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "30px");
                        writer.AddAttribute(HtmlTextWriterAttribute.Value, this.CurrentPageIndex.ToString());
                        if (!string.IsNullOrEmpty(this.PageIndexBoxStyle))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Style, this.PageIndexBoxStyle);
                        }
                        if (!string.IsNullOrEmpty(this.PageIndexBoxClass))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, this.PageIndexBoxClass);
                        }
                        if (!this.Enabled || ((this.PageCount <= 1) && this.AlwaysShow))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
                        }
                        writer.AddAttribute(HtmlTextWriterAttribute.Name, str);
                        writer.AddAttribute(HtmlTextWriterAttribute.Id, str);
                        string str2 = string.Concat(new object[] { "ANP_checkInput('", str, "',", this.PageCount, ")" });
                        string str3 = "ANP_keydown(event,'" + this.UniqueID + "_btn');";
                        string str4 = "if(" + str2 + "){ANP_goToPage(document.getElementById('" + str + "'));}";
                        writer.AddAttribute("onkeydown", str3);
                        writer.RenderBeginTag(HtmlTextWriterTag.Input);
                        writer.RenderEndTag();
                        if (!string.IsNullOrEmpty(this.TextAfterPageIndexBox))
                        {
                            writer.Write(this.TextAfterPageIndexBox);
                        }
                        writer.AddAttribute(HtmlTextWriterAttribute.Type, this.UrlPaging ? "Button" : "Submit");
                        writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
                        writer.AddAttribute(HtmlTextWriterAttribute.Id, this.UniqueID + "_btn");
                        writer.AddAttribute(HtmlTextWriterAttribute.Value, this.SubmitButtonText);
                        if (!string.IsNullOrEmpty(this.SubmitButtonClass))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, this.SubmitButtonClass);
                        }
                        if (!string.IsNullOrEmpty(this.SubmitButtonStyle))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Style, this.SubmitButtonStyle);
                        }
                        if (!this.Enabled || ((this.PageCount <= 1) && this.AlwaysShow))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
                        }
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, this.UrlPaging ? str4 : ("return " + str2));
                        writer.RenderBeginTag(HtmlTextWriterTag.Input);
                        writer.RenderEndTag();
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Name, str);
                        writer.AddAttribute(HtmlTextWriterAttribute.Id, str);
                        writer.AddAttribute(HtmlTextWriterAttribute.Onchange, this.UrlPaging ? "ANP_goToPage(this)" : this.Page.ClientScript.GetPostBackEventReference(this, null));
                        writer.RenderBeginTag(HtmlTextWriterTag.Select);
                        if (this.PageCount > 80)
                        {
                            if (this.CurrentPageIndex <= 15)
                            {
                                this.listPageIndexes(writer, 1, 15);
                                this.addMoreListItem(writer, 0x10);
                                this.listPageIndexes(writer, this.PageCount - 4, this.PageCount);
                            }
                            else if (this.CurrentPageIndex >= (this.PageCount - 14))
                            {
                                this.listPageIndexes(writer, 1, 5);
                                this.addMoreListItem(writer, this.PageCount - 15);
                                this.listPageIndexes(writer, this.PageCount - 14, this.PageCount);
                            }
                            else
                            {
                                this.listPageIndexes(writer, 1, 5);
                                this.addMoreListItem(writer, this.CurrentPageIndex - 6);
                                this.listPageIndexes(writer, this.CurrentPageIndex - 5, this.CurrentPageIndex + 5);
                                this.addMoreListItem(writer, this.CurrentPageIndex + 6);
                                this.listPageIndexes(writer, this.PageCount - 4, this.PageCount);
                            }
                        }
                        else
                        {
                            this.listPageIndexes(writer, 1, this.PageCount);
                        }
                        writer.RenderEndTag();
                        if (!string.IsNullOrEmpty(this.TextAfterPageIndexBox))
                        {
                            writer.Write(this.TextAfterPageIndexBox);
                        }
                    }

                    #region
                    this.CreatePageSizeSelect(writer);
                    #endregion
                }
                if (this.ShowCustomInfoSection != Wuqi.Webdiyer.ShowCustomInfoSection.Never)
                {
                    writer.RenderEndTag();
                }
                if (this.ShowCustomInfoSection == Wuqi.Webdiyer.ShowCustomInfoSection.Right)
                {
                    this.RenderCustomInfoSection(writer);
                }
            }
        }

        private void RenderCustomInfoSection(HtmlTextWriter writer)
        {
            if (this.Height != Unit.Empty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, this.Height.ToString());
            }
            //writer.AddStyleAttribute("float", "left");
            string str = this.CustomInfoSectionWidth.ToString();
            if ((this.CustomInfoClass != null) && (this.CustomInfoClass.Trim().Length > 0))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CustomInfoClass);
            }
            if ((this.CustomInfoStyle != null) && (this.CustomInfoStyle.Trim().Length > 0))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Style, this.CustomInfoStyle);
            }
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, str);
            if (this.CustomInfoTextAlign != HorizontalAlign.NotSet)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Align, this.CustomInfoTextAlign.ToString().ToLower());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(this.GetCustomInfoHTML(this.CustomInfoHTML));
            writer.RenderEndTag();
        }

        public override void RenderEndTag(HtmlTextWriter writer)
        {
            if ((this.PageCount > 1) || ((this.PageCount <= 1) && this.AlwaysShow))
            {
                base.RenderEndTag(writer);
            }
            writer.WriteLine();
        }

        private void WriteCssClass(HtmlTextWriter writer)
        {
            if ((this.cssClassName != null) && (this.cssClassName.Trim().Length > 0))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.cssClassName);
            }
        }

        private void writeSpacingStyle(HtmlTextWriter writer)
        {
            if (this.PagingButtonSpacing.Value != 0.0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.MarginRight, this.PagingButtonSpacing.ToString());
            }
        }

        [ANPDescription("desc_AlwaysShow"), Browsable(true), Themeable(true), Category("Behavior"), DefaultValue(false)]
        public bool AlwaysShow
        {
            get
            {
                object obj2 = this.ViewState["AlwaysShow"];
                if (obj2 != null)
                {
                    return (bool)obj2;
                }
                return ((this.cloneFrom != null) && this.cloneFrom.AlwaysShow);
            }
            set
            {
                this.ViewState["AlwaysShow"] = value;
            }
        }

        [ANPDescription("desc_ButtonImageAlign"), Category("Appearance"), DefaultValue(0), Browsable(true)]
        public ImageAlign ButtonImageAlign
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ButtonImageAlign;
                }
                object obj2 = this.ViewState["ButtonImageAlign"];
                if (obj2 != null)
                {
                    return (ImageAlign)obj2;
                }
                return ImageAlign.NotSet;
            }
            set
            {
                if ((value != ImageAlign.Right) && (value != ImageAlign.Left))
                {
                    this.ViewState["ButtonImageAlign"] = value;
                }
            }
        }

        [Browsable(true), ANPDescription("desc_ButtonImageExtension"), Category("Appearance"), Themeable(true), DefaultValue(".gif")]
        public string ButtonImageExtension
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ButtonImageExtension;
                }
                object obj2 = this.ViewState["ButtonImageExtension"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return ".gif";
            }
            set
            {
                string str = value.Trim();
                this.ViewState["ButtonImageExtension"] = str.StartsWith(".") ? str : ("." + str);
            }
        }

        [Themeable(true), ANPDescription("desc_ButtonImageNameExtension"), Category("Appearance"), DefaultValue((string)null), Browsable(true)]
        public string ButtonImageNameExtension
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ButtonImageNameExtension;
                }
                object obj2 = this.ViewState["ButtonImageNameExtension"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["ButtonImageNameExtension"] = value;
            }
        }

        [ANPDescription("desc_CenterCurrentPageButton"), DefaultValue(false), ANPCategory("Behavior"), Browsable(true), Themeable(true)]
        public bool CenterCurrentPageButton
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CenterCurrentPageButton;
                }
                object obj2 = this.ViewState["CenterCurrentPageButton"];
                return ((obj2 != null) && ((bool)obj2));
            }
            set
            {
                this.ViewState["CenterCurrentPageButton"] = value;
            }
        }

        [DefaultValue(false), TypeConverter(typeof(AspNetPagerIDConverter)), ANPDescription("desc_CloneFrom"), Category("Behavior"), Browsable(true), Themeable(false)]
        public string CloneFrom
        {
            get
            {
                return (string)this.ViewState["CloneFrom"];
            }
            set
            {
                if ((value != null) && (string.Empty == value.Trim()))
                {
                    throw new ArgumentNullException("CloneFrom", "The Value of property CloneFrom can not be empty string!");
                }
                if (this.ID.Equals(value, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ArgumentException("The property value of CloneFrom can not be set to control itself!", "CloneFrom");
                }
                this.ViewState["CloneFrom"] = value;
            }
        }

        [DefaultValue((string)null), ANPDescription("desc_CpiButtonImageNameExtension"), Themeable(true), Browsable(true), Category("Appearance")]
        public string CpiButtonImageNameExtension
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CpiButtonImageNameExtension;
                }
                object obj2 = this.ViewState["CpiButtonImageNameExtension"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return this.ButtonImageNameExtension;
            }
            set
            {
                this.ViewState["CpiButtonImageNameExtension"] = value;
            }
        }

        [Category("Appearance"), DefaultValue((string)null), Browsable(true), ANPDescription("desc_CssClass")]
        public override string CssClass
        {
            get
            {
                return base.CssClass;
            }
            set
            {
                base.CssClass = value;
                this.cssClassName = value;
            }
        }

        [ANPDescription("desc_CurrentPageButtonClass"), Browsable(true), DefaultValue((string)null), Category("Appearance")]
        public string CurrentPageButtonClass
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CurrentPageButtonClass;
                }
                object obj2 = this.ViewState["CPBClass"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["CPBClass"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_CurrentPageButtonStyle"), DefaultValue((string)null), Category("Appearance")]
        public string CurrentPageButtonStyle
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CurrentPageButtonStyle;
                }
                object obj2 = this.ViewState["CPBStyle"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["CPBStyle"] = value;
            }
        }

        [Browsable(true), Themeable(true), DefaultValue(""), ANPCategory("cat_Navigation"), ANPDescription("desc_CPBTextFormatString")]
        public string CurrentPageButtonTextFormatString
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CurrentPageButtonTextFormatString;
                }
                object obj2 = this.ViewState["CurrentPageButtonTextFormatString"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return this.NumericButtonTextFormatString;
            }
            set
            {
                this.ViewState["CurrentPageButtonTextFormatString"] = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), DefaultValue(1), ReadOnly(true), Browsable(false), ANPDescription("desc_CurrentPageIndex"), ANPCategory("cat_Paging")]
        public int CurrentPageIndex
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CurrentPageIndex;
                }
                object obj2 = this.ViewState["CurrentPageIndex"];
                int num = (obj2 == null) ? 1 : ((int)obj2);
                if ((num > this.PageCount) && (this.PageCount > 0))
                {
                    return this.PageCount;
                }
                if (num < 1)
                {
                    return 1;
                }
                return num;
            }
            set
            {
                int pageCount = value;
                if (pageCount < 1)
                {
                    pageCount = 1;
                }
                else if (pageCount > this.PageCount)
                {
                    pageCount = this.PageCount;
                }
                this.ViewState["CurrentPageIndex"] = pageCount;
            }
        }

        [DefaultValue((string)null), ANPDescription("desc_CustomInfoClass"), Category("Appearance"), Browsable(true)]
        public string CustomInfoClass
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CustomInfoClass;
                }
                object obj2 = this.ViewState["CustomInfoClass"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return this.CssClass;
            }
            set
            {
                this.ViewState["CustomInfoClass"] = value;
            }
        }

        [ANPDescription("desc_CustomInfoHTML"), Browsable(true), Themeable(true), Category("Appearance"), DefaultValue("Page %CurrentPageIndex% of %PageCount%")]
        public string CustomInfoHTML
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CustomInfoHTML;
                }
                object obj2 = this.ViewState["CustomInfoText"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "Page %CurrentPageIndex% of %PageCount%";
            }
            set
            {
                this.ViewState["CustomInfoText"] = value;
            }
        }

        [ANPDescription("desc_CustomInfoSectionWidth"), Browsable(true), Category("Appearance"), DefaultValue(typeof(Unit), "40%")]
        public Unit CustomInfoSectionWidth
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CustomInfoSectionWidth;
                }
                object obj2 = this.ViewState["CustomInfoSectionWidth"];
                if (obj2 != null)
                {
                    return (Unit)obj2;
                }
                return Unit.Percentage(40.0);
            }
            set
            {
                this.ViewState["CustomInfoSectionWidth"] = value;
            }
        }

        [Category("Appearance"), Browsable(true), ANPDescription("desc_CustomInfoStyle"), DefaultValue((string)null)]
        public string CustomInfoStyle
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CustomInfoStyle;
                }
                object obj2 = this.ViewState["CustomInfoStyle"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return base.Style.Value;
            }
            set
            {
                this.ViewState["CustomInfoStyle"] = value;
            }
        }

        [ANPDescription("desc_CustomInfoTextAlign"), Browsable(true), Category("Appearance"), DefaultValue(0)]
        public HorizontalAlign CustomInfoTextAlign
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.CustomInfoTextAlign;
                }
                object obj2 = this.ViewState["CustomInfoTextAlign"];
                if (obj2 != null)
                {
                    return (HorizontalAlign)obj2;
                }
                return HorizontalAlign.NotSet;
            }
            set
            {
                this.ViewState["CustomInfoTextAlign"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_DisabledButtonImageNameExtension"), Themeable(true), DefaultValue((string)null), Category("Appearance")]
        public string DisabledButtonImageNameExtension
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.DisabledButtonImageNameExtension;
                }
                object obj2 = this.ViewState["DisabledButtonImageNameExtension"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return this.ButtonImageNameExtension;
            }
            set
            {
                this.ViewState["DisabledButtonImageNameExtension"] = value;
            }
        }

        public override bool EnableTheming
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.EnableTheming;
                }
                return base.EnableTheming;
            }
            set
            {
                base.EnableTheming = value;
            }
        }

        [Category("Behavior"), ANPDescription("desc_EnableUrlWriting"), Themeable(true), Browsable(true), DefaultValue(false)]
        public bool EnableUrlRewriting
        {
            get
            {
                object obj2 = this.ViewState["UrlRewriting"];
                if (obj2 != null)
                {
                    return (bool)obj2;
                }
                return ((this.cloneFrom != null) && this.cloneFrom.EnableUrlRewriting);
            }
            set
            {
                this.ViewState["UrlRewriting"] = value;
                if (value)
                {
                    this.UrlPaging = true;
                }
            }
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int EndRecordIndex
        {
            get
            {
                return (this.RecordCount - this.RecordsRemain);
            }
        }

        [ANPDescription("desc_FirstPageText"), ANPCategory("cat_Navigation"), DefaultValue("&lt;&lt;"), Themeable(true), Browsable(true)]
        public string FirstPageText
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.FirstPageText;
                }
                object obj2 = this.ViewState["FirstPageText"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "&lt;&lt;";
            }
            set
            {
                this.ViewState["FirstPageText"] = value;
            }
        }

        [DefaultValue((string)null), Browsable(true), Category("Appearance"), ANPDescription("desc_ImagePath")]
        public string ImagePath
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ImagePath;
                }
                string relativeUrl = (string)this.ViewState["ImagePath"];
                if (relativeUrl != null)
                {
                    relativeUrl = base.ResolveUrl(relativeUrl);
                }
                return relativeUrl;
            }
            set
            {
                string str = value.Trim().Replace(@"\", "/");
                this.ViewState["ImagePath"] = str.EndsWith("/") ? str : (str + "/");
            }
        }

        [Obsolete("该属性已废弃，请使用 PageIndexBoxClass 属性"), ANPDescription("desc_InputBoxClass"), Browsable(false), ANPCategory("cat_PageIndexBox"), DefaultValue((string)null)]
        public string InputBoxClass
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.InputBoxClass;
                }
                object obj2 = this.ViewState["PageIndexBoxClass"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                if (value.Trim().Length > 0)
                {
                    this.ViewState["PageIndexBoxClass"] = value;
                }
            }
        }

        [Obsolete("该属性已废弃，请使用 PageIndexBoxStyle 属性"), ANPCategory("cat_PageIndexBox"), DefaultValue((string)null), ANPDescription("desc_InputBoxStyle"), Browsable(false)]
        public string InputBoxStyle
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.InputBoxStyle;
                }
                object obj2 = this.ViewState["PageIndexBoxStyle"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                if (value.Trim().Length > 0)
                {
                    this.ViewState["PageIndexBoxStyle"] = value;
                }
            }
        }

        [Browsable(true), Category("Data"), Themeable(true), ANPDescription("desc_InvalidPIErrorMsg"), ANPDefaultValue("def_InvalidPIErrorMsg")]
        public string InvalidPageIndexErrorMessage
        {
            get
            {
                object obj2 = this.ViewState["InvalidPIErrorMsg"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.InvalidPageIndexErrorMessage;
                }
                return Wuqi.Webdiyer.SR.GetString("def_InvalidPIErrorMsg");
            }
            set
            {
                this.ViewState["InvalidPIErrorMsg"] = value;
            }
        }

        [ANPCategory("cat_Navigation"), DefaultValue("&gt;&gt;"), Browsable(true), Themeable(true), ANPDescription("desc_LastPageText")]
        public string LastPageText
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.LastPageText;
                }
                object obj2 = this.ViewState["LastPageText"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "&gt;&gt;";
            }
            set
            {
                this.ViewState["LastPageText"] = value;
            }
        }

        [DefaultValue(0), ANPDescription("desc_MoreButtonType"), Themeable(true), ANPCategory("cat_Navigation"), Browsable(true)]
        public Wuqi.Webdiyer.PagingButtonType MoreButtonType
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.MoreButtonType;
                }
                object obj2 = this.ViewState["MoreButtonType"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.PagingButtonType)obj2;
                }
                return this.PagingButtonType;
            }
            set
            {
                this.ViewState["MoreButtonType"] = value;
            }
        }

        [DefaultValue(0), Browsable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_NavigationButtonType"), Themeable(true)]
        public Wuqi.Webdiyer.PagingButtonType NavigationButtonType
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.NavigationButtonType;
                }
                object obj2 = this.ViewState["NavigationButtonType"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.PagingButtonType)obj2;
                }
                return this.PagingButtonType;
            }
            set
            {
                this.ViewState["NavigationButtonType"] = value;
            }
        }

        [ANPCategory("cat_Navigation"), Browsable(true), ANPDefaultValue("def_NavigationToolTipTextFormatString"), ANPDescription("desc_NavigationToolTipTextFormatString"), Themeable(true)]
        public string NavigationToolTipTextFormatString
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.NavigationToolTipTextFormatString;
                }
                object obj2 = this.ViewState["NvToolTipFormatString"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                if (this.ShowNavigationToolTip)
                {
                    return Wuqi.Webdiyer.SR.GetString("def_NavigationToolTipTextFormatString");
                }
                return null;
            }
            set
            {
                string str = value;
                if ((str.Trim().Length < 1) && (str.IndexOf("{0}") < 0))
                {
                    str = "{0}";
                }
                this.ViewState["NvToolTipFormatString"] = str;
            }
        }

        [Themeable(true), Browsable(true), ANPDescription("desc_NextPageText"), ANPCategory("cat_Navigation"), DefaultValue("下一页")]//
        public string NextPageText
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.NextPageText;
                }
                object obj2 = this.ViewState["NextPageText"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "下一页";
            }
            set
            {
                this.ViewState["NextPageText"] = value;
            }
        }

        [DefaultValue(5), Browsable(true), Themeable(true), ANPDescription("desc_NumericButtonCount"), ANPCategory("cat_Navigation")]
        public int NumericButtonCount
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.NumericButtonCount;
                }
                object obj2 = this.ViewState["NumericButtonCount"];
                if (obj2 != null)
                {
                    return (int)obj2;
                }
                return 5;
            }
            set
            {
                this.ViewState["NumericButtonCount"] = value;
            }
        }

        [DefaultValue(""), ANPDescription("desc_NBTFormatString"), Themeable(true), Browsable(true), ANPCategory("cat_Navigation")]
        public string NumericButtonTextFormatString
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.NumericButtonTextFormatString;
                }
                object obj2 = this.ViewState["NumericButtonTextFormatString"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return string.Empty;
            }
            set
            {
                this.ViewState["NumericButtonTextFormatString"] = value;
            }
        }

        [ANPDescription("desc_NumericButtonType"), Browsable(true), Themeable(true), DefaultValue(0), ANPCategory("cat_Navigation")]
        public Wuqi.Webdiyer.PagingButtonType NumericButtonType
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.NumericButtonType;
                }
                object obj2 = this.ViewState["NumericButtonType"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.PagingButtonType)obj2;
                }
                return this.PagingButtonType;
            }
            set
            {
                this.ViewState["NumericButtonType"] = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
        public int PageCount
        {
            get
            {
                if (this.RecordCount == 0)
                {
                    return 1;
                }
                return (int)Math.Ceiling((double)(((double)this.RecordCount) / ((double)this.PageSize)));
            }
        }

        [Browsable(true), ANPDescription("desc_PageIndexBoxClasss"), ANPCategory("cat_PageIndexBox"), DefaultValue((string)null)]
        public string PageIndexBoxClass
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PageIndexBoxClass;
                }
                object obj2 = this.ViewState["PageIndexBoxClass"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                if (value.Trim().Length > 0)
                {
                    this.ViewState["PageIndexBoxClass"] = value;
                }
            }
        }

        [ANPDescription("desc_PageIndexBoxStyle"), DefaultValue((string)null), Browsable(true), ANPCategory("cat_PageIndexBox")]
        public string PageIndexBoxStyle
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PageIndexBoxStyle;
                }
                object obj2 = this.ViewState["PageIndexBoxStyle"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                if (value.Trim().Length > 0)
                {
                    this.ViewState["PageIndexBoxStyle"] = value;
                }
            }
        }

        [Browsable(true), ANPDescription("desc_PageIndexBoxType"), ANPCategory("cat_PageIndexBox"), DefaultValue((string)null)]
        public Wuqi.Webdiyer.PageIndexBoxType PageIndexBoxType
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PageIndexBoxType;
                }
                object obj2 = this.ViewState["PageIndexBoxType"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.PageIndexBoxType)obj2;
                }
                return Wuqi.Webdiyer.PageIndexBoxType.TextBox;
            }
            set
            {
                this.ViewState["PageIndexBoxType"] = value;
            }
        }

        [ANPDescription("desc_PIOutOfRangeMsg"), Category("Data"), Themeable(true), Browsable(true), ANPDefaultValue("def_PIOutOfRangerMsg")]
        public string PageIndexOutOfRangeErrorMessage
        {
            get
            {
                object obj2 = this.ViewState["PIOutOfRangeErrorMsg"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PageIndexOutOfRangeErrorMessage;
                }
                return Wuqi.Webdiyer.SR.GetString("def_PIOutOfRangerMsg");
            }
            set
            {
                this.ViewState["PIOutOfRangeErrorMsg"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_PageSize"), DefaultValue(10), ANPCategory("cat_Paging")]
        public int PageSize
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PageSize;
                }
                object obj2 = this.ViewState["PageSize"];
                if (obj2 != null)
                {
                    return (int)obj2;
                }
                return 10;
            }
            set
            {
                this.ViewState["PageSize"] = value;
            }
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int PagesRemain
        {
            get
            {
                return (this.PageCount - this.CurrentPageIndex);
            }
        }

        [Themeable(true), Browsable(true), ANPDescription("desc_PagingButtonSpacing"), ANPCategory("cat_Navigation"), DefaultValue(typeof(Unit), "5px")]
        public Unit PagingButtonSpacing
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PagingButtonSpacing;
                }
                object obj2 = this.ViewState["PagingButtonSpacing"];
                if (obj2 != null)
                {
                    return Unit.Parse(obj2.ToString());
                }
                return Unit.Pixel(5);
            }
            set
            {
                this.ViewState["PagingButtonSpacing"] = value;
            }
        }

        [ANPDescription("desc_PagingButtonType"), Browsable(true), Themeable(true), DefaultValue(0), ANPCategory("cat_Navigation")]
        public Wuqi.Webdiyer.PagingButtonType PagingButtonType
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PagingButtonType;
                }
                object obj2 = this.ViewState["PagingButtonType"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.PagingButtonType)obj2;
                }
                return Wuqi.Webdiyer.PagingButtonType.Text;
            }
            set
            {
                this.ViewState["PagingButtonType"] = value;
            }
        }

        [ANPCategory("cat_Navigation"), Themeable(true), ANPDescription("desc_PrevPageText"), Browsable(true), DefaultValue("上一页")]// DefaultValue("&lt;")
        public string PrevPageText
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.PrevPageText;
                }
                object obj2 = this.ViewState["PrevPageText"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "上一页";
            }
            set
            {
                this.ViewState["PrevPageText"] = value;
            }
        }

        [ANPDescription("desc_RecordCount"), DefaultValue(0), Browsable(false), Category("Data")]
        public int RecordCount
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.RecordCount;
                }
                object obj2 = this.ViewState["Recordcount"];
                if (obj2 != null)
                {
                    return (int)obj2;
                }
                return 0;
            }
            set
            {
                this.ViewState["Recordcount"] = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
        public int RecordsRemain
        {
            get
            {
                if (this.CurrentPageIndex < this.PageCount)
                {
                    return (this.RecordCount - (this.CurrentPageIndex * this.PageSize));
                }
                return 0;
            }
        }

        [Browsable(true), ANPDescription("desc_ReverseUrlPageIndex"), DefaultValue(false), ANPCategory("cat_Paging")]
        public bool ReverseUrlPageIndex
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ReverseUrlPageIndex;
                }
                object obj2 = this.ViewState["ReverseUrlPageIndex"];
                return ((obj2 != null) && ((bool)obj2));
            }
            set
            {
                this.ViewState["ReverseUrlPageIndex"] = value;
            }
        }

        [DefaultValue(30), Browsable(true), Themeable(true), ANPDescription("desc_ShowBoxThreshold"), ANPCategory("cat_PageIndexBox")]
        public int ShowBoxThreshold
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowBoxThreshold;
                }
                object obj2 = this.ViewState["ShowBoxThreshold"];
                if (obj2 != null)
                {
                    return (int)obj2;
                }
                return 30;
            }
            set
            {
                this.ViewState["ShowBoxThreshold"] = value;
            }
        }

        [Category("Appearance"), DefaultValue(0), Themeable(true), ANPDescription("desc_ShowCustomInfoSection"), Browsable(true)]
        public Wuqi.Webdiyer.ShowCustomInfoSection ShowCustomInfoSection
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowCustomInfoSection;
                }
                object obj2 = this.ViewState["ShowCustomInfoSection"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.ShowCustomInfoSection)obj2;
                }
                return Wuqi.Webdiyer.ShowCustomInfoSection.Never;
            }
            set
            {
                this.ViewState["ShowCustomInfoSection"] = value;
            }
        }

        [ANPCategory("cat_Navigation"), Themeable(true), ANPDescription("desc_ShowDisabledButtons"), DefaultValue(true), Browsable(true)]
        public bool ShowDisabledButtons
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowDisabledButtons;
                }
                object obj2 = this.ViewState["ShowDisabledButtons"];
                if (obj2 != null)
                {
                    return (bool)obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["ShowDisabledButtons"] = value;
            }
        }

        [Browsable(true), DefaultValue(true), Themeable(true), ANPDescription("desc_ShowFirstLast"), ANPCategory("cat_Navigation")]
        public bool ShowFirstLast
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowFirstLast;
                }
                object obj2 = this.ViewState["ShowFirstLast"];
                if (obj2 != null)
                {
                    return (bool)obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["ShowFirstLast"] = value;
            }
        }

        [Browsable(false), Obsolete("该属性已废弃，请使用 ShowPageIndexBox 属性"), ANPCategory("cat_PageIndexBox"), Themeable(false), ANPDescription("desc_ShowInputBox"), DefaultValue(1)]
        public Wuqi.Webdiyer.ShowInputBox ShowInputBox
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowInputBox;
                }
                object obj2 = this.ViewState["ShowInputBox"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.ShowInputBox)obj2;
                }
                return Wuqi.Webdiyer.ShowInputBox.Auto;
            }
            set
            {
                this.ViewState["ShowInputBox"] = value;
            }
        }

        [Themeable(true), Browsable(true), ANPCategory("cat_Navigation"), DefaultValue(false), ANPDescription("desc_ShowNavigationToolTip")]
        public bool ShowNavigationToolTip
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowNavigationToolTip;
                }
                object obj2 = this.ViewState["ShowNvToolTip"];
                return ((obj2 != null) && ((bool)obj2));
            }
            set
            {
                this.ViewState["ShowNvToolTip"] = value;
            }
        }

        [DefaultValue(true), ANPDescription("desc_ShowPageIndex"), Browsable(true), ANPCategory("cat_Navigation"), Themeable(true)]
        public bool ShowPageIndex
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowPageIndex;
                }
                object obj2 = this.ViewState["ShowPageIndex"];
                if (obj2 != null)
                {
                    return (bool)obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["ShowPageIndex"] = value;
            }
        }

        [ANPDescription("desc_ShowPageIndexBox"), Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue((string)null)]
        public Wuqi.Webdiyer.ShowPageIndexBox ShowPageIndexBox
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowPageIndexBox;
                }
                object obj2 = this.ViewState["ShowPageIndexBox"];
                if (obj2 != null)
                {
                    return (Wuqi.Webdiyer.ShowPageIndexBox)obj2;
                }
                return Wuqi.Webdiyer.ShowPageIndexBox.Auto;
            }
            set
            {
                this.ViewState["ShowPageIndexBox"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_ShowPrevNext"), DefaultValue(true), ANPCategory("cat_Navigation"), Themeable(true)]
        public bool ShowPrevNext
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.ShowPrevNext;
                }
                object obj2 = this.ViewState["ShowPrevNext"];
                if (obj2 != null)
                {
                    return (bool)obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["ShowPrevNext"] = value;
            }
        }

        public override string SkinID
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.SkinID;
                }
                return base.SkinID;
            }
            set
            {
                base.SkinID = value;
            }
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int StartRecordIndex
        {
            get
            {
                return (((this.CurrentPageIndex - 1) * this.PageSize) + 1);
            }
        }

        [Browsable(true), DefaultValue((string)null), ANPDescription("desc_SubmitButtonClass"), ANPCategory("cat_PageIndexBox")]
        public string SubmitButtonClass
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.SubmitButtonClass;
                }
                object obj2 = this.ViewState["SubmitButtonClass"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["SubmitButtonClass"] = value;
            }
        }


        [ANPCategory("cat_PageIndexBox"), ANPDescription("desc_SubmitButtonStyle"), DefaultValue((string)null), Browsable(true)]
        public string SubmitButtonStyle
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.SubmitButtonStyle;
                }
                object obj2 = this.ViewState["SubmitButtonStyle"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["SubmitButtonStyle"] = value;
            }
        }

        [ANPDescription("desc_SubmitButtonText"), Browsable(true), DefaultValue("go"), Themeable(true), ANPCategory("cat_PageIndexBox")]
        public string SubmitButtonText
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.SubmitButtonText;
                }
                object obj2 = this.ViewState["SubmitButtonText"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "go";
            }
            set
            {
                if (value == null)
                {
                    value = "go";
                }
                this.ViewState["SubmitButtonText"] = value;
            }
        }

        [Obsolete("该属性已废弃，请使用 TextAfterPageIndexBox 属性"), ANPCategory("cat_PageIndexBox"), Browsable(false), Themeable(false), DefaultValue((string)null), ANPDescription("desc_TextAfterInputBox")]
        public string TextAfterInputBox
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.TextAfterInputBox;
                }
                object obj2 = this.ViewState["TextAfterPageIndexBox"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["TextAfterPageIndexBox"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_TextAfterPageIndexBox"), Themeable(true), DefaultValue((string)null), ANPCategory("cat_PageIndexBox")]
        public string TextAfterPageIndexBox
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.TextAfterPageIndexBox;
                }
                object obj2 = this.ViewState["TextAfterPageIndexBox"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["TextAfterPageIndexBox"] = value;
            }
        }

        [ANPDescription("desc_TextBeforeInputBox"), DefaultValue((string)null), Browsable(false), Themeable(false), ANPCategory("cat_PageIndexBox"), Obsolete("该属性已废弃，请使用 TextBeforePageIndexBox 属性")]
        public string TextBeforeInputBox
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.TextBeforeInputBox;
                }
                object obj2 = this.ViewState["TextBeforePageIndexBox"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["TextBeforePageIndexBox"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_TextBeforePageIndexBox"), Themeable(true), ANPCategory("cat_PageIndexBox"), DefaultValue((string)null)]
        public string TextBeforePageIndexBox
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.TextBeforePageIndexBox;
                }
                object obj2 = this.ViewState["TextBeforePageIndexBox"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return null;
            }
            set
            {
                this.ViewState["TextBeforePageIndexBox"] = value;
            }
        }

        [ANPCategory("cat_Paging"), ANPDescription("desc_UrlPageIndexName"), DefaultValue("page"), Browsable(true)]
        public string UrlPageIndexName
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.UrlPageIndexName;
                }
                object obj2 = this.ViewState["UrlPageIndexName"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                return "page";
            }
            set
            {
                this.ViewState["UrlPageIndexName"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_UrlPaging"), ANPCategory("cat_Paging"), DefaultValue(false)]
        public bool UrlPaging
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.UrlPaging;
                }
                object obj2 = this.ViewState["UrlPaging"];
                return ((obj2 != null) && ((bool)obj2));
            }
            set
            {
                this.ViewState["UrlPaging"] = value;
            }
        }

        [Themeable(true), TypeConverter(typeof(TargetConverter)), ANPDescription("desc_UrlPagingTarget"), Browsable(true), ANPCategory("cat_Navigation"), DefaultValue("")]
        public string UrlPagingTarget
        {
            get
            {
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.UrlPagingTarget;
                }
                return (string)this.ViewState["UrlPagingTarget"];
            }
            set
            {
                this.ViewState["UrlPagingTarget"] = value;
            }
        }

        [Browsable(true), ANPDescription("desc_UrlRewritePattern"), Themeable(true), Category("Behavior"), DefaultValue((string)null)]
        public string UrlRewritePattern
        {
            get
            {
                object obj2 = this.ViewState["URPattern"];
                if (obj2 != null)
                {
                    return (string)obj2;
                }
                if (this.cloneFrom != null)
                {
                    return this.cloneFrom.UrlRewritePattern;
                }
                if (this.EnableUrlRewriting)
                {
                    string filePath = this.Page.Request.FilePath;
                    return (Path.GetFileNameWithoutExtension(filePath) + "_{0}" + Path.GetExtension(filePath));
                }
                return null;
            }
            set
            {
                this.ViewState["URPattern"] = value;
            }
        }

        public override bool Wrap
        {
            get
            {
                return base.Wrap;
            }
            set
            {
                base.Wrap = false;
            }
        }
    }
}

